<?php

namespace App\Transformers;

use Illuminate\Database\Eloquent\Model;
use League\Fractal\TransformerAbstract;

class UserTransformer extends TransformerAbstract
{

    public function transform(Model $model)
    {
        $jpg = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545677970368&di=e914878a7a668135fd76c480bcdedb89&imgtype=0&src=http%3A%2F%2Fd.5857.com%2Fthumb%2F15398.jpg';
        return $model->attributesToArray() + [
                'avatar' => $jpg,
                'roles'  => [
                    'admin'
                ]
            ];
    }
}